#coding=utf-8
import arcpy
import pandas as pd

path = r'E:\workData\0913康定河流统计'

tl = r'E:\workData\0913康定河流统计\65条河管理范围线\All_102.shp'

cs = arcpy.da.SearchCursor(tl,['SHAPE@','名称'])
shpDatasList = [row for row in cs]
riverList = []
for sd in shpDatasList:
    if sd[1] not in riverList:
        riverList.append(sd[1])

df = pd.read_excel(r'C:\Users\Administrator\Desktop\新建文件夹\2.xlsx'.decode('utf-8'))
rnList_100 = []
for name, value in df.iterrows():
    rn = df.loc[name,'name']
    rnList_100.append(rn)
i=1
for rn in riverList:
    if rn in rnList_100:
        rl = []
        for sd in shpDatasList:
            if sd[1] == rn:
                rl.append(sd[0].length)
        print i,rn,sum(rl)
        i+=1


